package com.sjgtw.cloud.web.siteDisposalPlan.controller;

import java.util.List;
import java.io.IOException;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;

import com.sjgtw.cloud.common.core.web.controller.BaseController;
import com.sjgtw.cloud.common.core.web.domain.AjaxResult;
import com.sjgtw.cloud.common.core.web.page.TableDataInfo;
import com.sjgtw.cloud.web.siteDisposalPlan.domain.SiteDisposalPlan;
import com.sjgtw.cloud.web.siteDisposalPlan.service.ISiteDisposalPlanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 重点地段处置Controller
 * 
 * @author ruoyi
 * @date 2024-03-16
 */
@RestController
@Api(tags="1.12、重点地段处置")
@RequestMapping("/siteDisposalPlan")
public class SiteDisposalPlanController extends BaseController
{
    @Autowired
    private ISiteDisposalPlanService siteDisposalPlanService;

    /**
     * 查询重点地段处置列表
     */

    @GetMapping("/list")
    @ApiOperation("列表")
    public TableDataInfo list(SiteDisposalPlan siteDisposalPlan)
    {
        startPage();
        List<Map<String,Object>> list = siteDisposalPlanService.selectSiteDisposalPlanList(siteDisposalPlan);
        return getDataTable(list);
    }

    /**
     * 导出重点地段处置列表
     */
   /* @RequiresPermissions("system:plan:export")
    @Log(title = "重点地段处置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SiteDisposalPlan siteDisposalPlan)
    {
        List<SiteDisposalPlan> list = siteDisposalPlanService.selectSiteDisposalPlanList(siteDisposalPlan);
        ExcelUtil<SiteDisposalPlan> util = new ExcelUtil<SiteDisposalPlan>(SiteDisposalPlan.class);
        util.exportExcel(response, list, "重点地段处置数据");
    }*/

    /**
     * 获取重点地段处置详细信息
     */

    @GetMapping(value = "/getInfo/{id}")
    @ApiOperation("获取详情")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(siteDisposalPlanService.selectSiteDisposalPlanById(id));
    }

    /**
     * 新增重点地段处置
     */

    @PostMapping("/add")
    @ApiOperation("新增")
    public AjaxResult add(@RequestBody SiteDisposalPlan siteDisposalPlan)
    {
        return toAjax(siteDisposalPlanService.insertSiteDisposalPlan(siteDisposalPlan));
    }

    /**
     * 修改重点地段处置
     */

    @PutMapping("/edit")
    @ApiOperation("编辑")
    public AjaxResult edit(@RequestBody SiteDisposalPlan siteDisposalPlan)
    {
        return toAjax(siteDisposalPlanService.updateSiteDisposalPlan(siteDisposalPlan));
    }

    /**
     * 删除重点地段处置
     */

	@DeleteMapping("/delete/{id}")
    @ApiOperation("删除")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(siteDisposalPlanService.deleteSiteDisposalPlanById(id));
    }
}
